<div class="form">

    <?php $form=$this->beginWidget('CActiveForm', array(
    'id'=>'locations-form',
    'enableAjaxValidation'=>false,
    'htmlOptions'=>array(
        'enctype'=>'multipart/form-data',
    )
)); ?>

    <p class="note">Fields with <span class="required">*</span> are required.</p>

    <?php echo $form->errorSummary($model); ?>
    <div class="row">

        <?php echo $form->labelEx($model,'image'); ?>
        <?php echo $form->fileField($model,'file');?>
        <?php echo $form->error($model,'file'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'custno'); ?>
        <div class="model-data">
            <?php echo $model->custno; ?>
        </div>
        <?php echo $form->hiddenField($model,'custno')?>
        <?php echo $form->error($model,'custno'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'locno'); ?>
        <?php echo $form->textField($model,'locno',array('size'=>5,'maxlength'=>5,'value'=>$model->locationNumber)); ?>
        <?php echo $form->error($model,'locno'); ?>
    </div>




    <div class="row">
        <?php echo $form->labelEx($model,'locname'); ?>
        <?php echo $form->textField($model,'locname',array('size'=>50,'maxlength'=>50)); ?>
        <?php echo $form->error($model,'locname'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'locnickname'); ?>
        <?php echo $form->textField($model,'locnickname',array('size'=>50,'maxlength'=>50)); ?>
        <?php echo $form->error($model,'locnickname'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'add1'); ?>
        <?php echo $form->textField($model,'add1',array('size'=>50,'maxlength'=>50)); ?>
        <?php echo $form->error($model,'add1'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'add2'); ?>
        <?php echo $form->textField($model,'add2',array('size'=>50,'maxlength'=>50)); ?>
        <?php echo $form->error($model,'add2'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'city'); ?>
        <?php $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
        'model'=>$model,
        'attribute'=>'city',
        'sourceUrl'=>'index.php?r=ajax/searchCity',
        'options'=>array(
            'minLength'=>'4',
            'select'=>'js:function(event,ui){ getCityData(ui.item.value) }'
        ),

        'htmlOptions'=>array(
            //'style'=>'height:20px;'
        ),
    ));?>
        <?php echo $form->error($model,'city'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'state'); ?>
        <?php echo $form->dropDownList($model,'state',getStateList()); ?>
        <?php echo $form->error($model,'state'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'zip'); ?>
        <?php echo $form->textField($model,'zip',array('size'=>10,'maxlength'=>10)); ?>
        <?php echo $form->error($model,'zip'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'county');?>
        <?php echo $form->textField($model,'county');?>
        <div class="model-data">
            <a href='javascript:void(0)' onclick="searchCounty()">Lookup County</a>
        </div>
        <?php echo $form->error($model,'county');?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'isexempt'); ?>
        <?php echo $form->dropDownList($model,'isexempt',$model->getIsExemptList()); ?>
        <?php echo $form->error($model,'isexempt'); ?>
    </div>


    <?php echo $form->hiddenField($model,'taxfrp'); ?>

    <?php echo $form->hiddenField($model,'salesref',array('size'=>15,'maxlength'=>15)); ?>


    <div class="row">
        <?php echo $form->labelEx($model,'latitude'); ?>
        <?php echo $form->textField($model,'latitude', array('readonly'=>true)); ?>
        <?php echo $form->error($model,'latitude'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'longitude'); ?>
        <?php echo $form->textField($model,'longitude', array('readonly'=>true)); ?>
        <?php echo $form->error($model,'longitude'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'disableemails'); ?>
        <?php echo $form->checkBox($model,'disableemails'); ?>
        <?php echo $form->error($model,'disableemails'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'locationinactive'); ?>
        <?php echo $form->dropDownList($model,'locationinactive',$model->locationInactiveList); ?>
        <?php echo $form->error($model,'locationinactive'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'timezone'); ?>
        <?php echo $form->dropDownList($model,'timezone',$model->timeZoneList); ?>
        <?php echo $form->error($model,'timezone'); ?>
    </div>
    
<!--    <div class="row">
        <label>Total Paid</label>
        <div class="model-data">
            <?php //echo $model->getTotalPaidPayment()?>
        </div>
    </div>
    <div class="row">
        <label>Total Un-Paid</label>
        <div class="model-data">
            <?php //echo $model->getTotalUnpaidPayment()?>
        </div>
    </div>
    <div class="row">
        <label>Un-Invoiced Work</label>
        <div class="model-data">
            <?php //echo $model->getTotalUninvoicedWork()?>
        </div>
    </div>-->

    <div class="row">
        <?php echo $form->labelEx($model,'notes'); ?>
        <?php echo $form->textArea($model,'notes',array('size'=>60,'maxlength'=>255)); ?>
        <?php echo $form->error($model,'notes'); ?>
    </div>

    <div class="row_buttons">
        <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
    </div>

    <?php $this->endWidget(); ?>

</div><!-- form -->